package com.sertaogames.mundoj.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.sertaogames.mundoj.utils.JDOUtils;

public abstract class BasicServlet extends HttpServlet {

	private static final long serialVersionUID = 1L;
	protected JDOUtils jdo;

	@Override
	protected final void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		jdo = (JDOUtils) req.getAttribute("jdo");
		execute(req,resp);
	}
	
	protected abstract void execute(HttpServletRequest req, HttpServletResponse resp);

	@Override
	protected final void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		jdo = (JDOUtils) req.getAttribute("jdo");
		doPost(req, resp);
	}
	
}
